﻿<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-access="property" default-lazy="true" namespace="Cms.Domain" assembly="Cms.Domain">
  <class name="Category" table="cmsCategory">
    <cache usage="read-write" />
    <id name="ID" type="System.Int32" unsaved-value="0">
      <column name="ID" />
      <generator class="identity" />
    </id>
    <property name="Name" type="System.String">
      <column name="Name" not-null="true" />
    </property>
    <property name="FolderName" type="System.String">
      <column name="FolderName" not-null="false" />
    </property>
    <property name="DefaultSortKey" type="NHibernate.Type.EnumStringType`1[[Cms.Domain.DefaultCategorySortKey, Cms.Domain]], NHibernate">
      <column name="DefaultSortKey" length="20" not-null="true" />
    </property>
    <many-to-one class="Site" name="Site">
      <column name="SiteID" not-null="true" />
    </many-to-one>
    <many-to-one class="Category" name="Parent">
      <column name="ParentID" />
    </many-to-one>
    <bag cascade="save-update" inverse="true" name="SubCategories" mutable="true">
      <cache usage="read-write" />
      <key>
        <column name="ParentID" />
      </key>
      <one-to-many class="Category" />
    </bag>
    <bag inverse="true" name="Pages" table="cmsPageCategory" mutable="true">
      <cache usage="read-write" />
      <key>
        <column name="CategoryID" />
      </key>
      <many-to-many class="Page">
        <column name="PageID" />
      </many-to-many>
    </bag>
    <bag inverse="true" name="Folders" table="cmsFolderCategory" mutable="true">
      <cache usage="read-write" />
      <key>
        <column name="CategoryID" />
      </key>
      <many-to-many class="Folder">
        <column name="FolderID" />
      </many-to-many>
    </bag>
    <bag inverse="true" name="MediaFiles" table="cmsMediaFileCategory" mutable="true">
      <cache usage="read-write" />
      <key>
        <column name="CategoryID" />
      </key>
      <many-to-many class="MediaFile">
        <column name="MediaFileID" />
      </many-to-many>
    </bag>
    <bag inverse="true" name="MediaFolders" table="cmsMediaFolderCategory" mutable="true">
      <cache usage="read-write" />
      <key>
        <column name="CategoryID" />
      </key>
      <many-to-many class="MediaFolder">
        <column name="MediaFolderID" />
      </many-to-many>
    </bag>
    <bag inverse="true" name="Content" table="cmsContentCategory" mutable="true">
      <cache usage="read-write" />
      <key>
        <column name="CategoryID" />
      </key>
      <many-to-many class="Content">
        <column name="ContentID" />
      </many-to-many>
    </bag>
    <bag inverse="true" name="RssFeeds" table="cmsRssFeedCategory" mutable="true">
      <cache usage="read-write" />
      <key>
        <column name="CategoryID" />
      </key>
      <many-to-many class="RssFeed">
        <column name="RssFeedID" />
      </many-to-many>
    </bag>
  </class>
</hibernate-mapping>